#!usr/bin/python
# -*- coding:utf-8 -*-

"""
指令：demo alibabadev
"""
import .demo.alibabadev.aop

import aop.api

ACCOUNT_INOF={'appKey':1120116,'appSecret':'17EjiRaD3Kw4','access_token':'7da60749-be87-4c1c-9f17-4724dc669898'}

class Pyalibabadev:
    def __init__(self,sett):
        self.sett = sett
        self.appKey=ACCOUNT_INOF['appKey']
        self.appSecret = ACCOUNT_INOF['appSecret']
        self.accessToken = ACCOUNT_INOF['accessToken']

    def run(self):
        self.sett.log.info("当前工程项目运行文件：%s.py"%(self.__class__.__name__).lower())

        aop.set_default_server('gw.open.1688.com')
        aop.set_default_appinfo(self.appKey,  self.appSecret)

        custom_timestamp_generator = aop.api.GetServerTimestampRequest().get_response()
        aop.set_timestamp_generator(custom_timestamp_generator)

        req = aop.api.ProductSearchOfferRecommendParam()
        req.access_token = self.accessToken
        req.other_param ={
          "recommendOfferParam": {
            "beginPage": "1",
            "pageSize": "20",
            "country": "en",
            "outMemberId": "dferg0001"
          }
        }
        print(req.get_response())
